import tkinter as tk
import dev1
import Ping_Tool
import SSH_Interaction
import Telnet_Interaction

class MainApplication(tk.Frame):
    def __init__(self, parent):  # 初始化主界面
        super().__init__(parent)
        self.parent = parent
        self.pack()

        ####标题####第一行####
        lb0 = tk.Label(root, text='网络工程师工具箱', font=('庞门正道标题体3.0', 24))
        lb0.place(relx=0.1, rely=0.02, relwidth=0.8, relheight=0.1)

        ####IP地址####第二行####

        ipad = tk.Button(root, text='Ping测试',font=('仓耳舒圆体 W04', 12),command=self.open_Ping_Tool)
        ipad.place(relx=0.1, rely=0.18, relwidth=0.15, relheight=0.08)

        lb1 = tk.Label(root, text='''V1.2 已测试''',font=('仓耳舒圆体 W04', 10))
        lb1.place(relx=0.27, rely=0.18, relwidth=0.2, relheight=0.08)

        ####第二行结束####

        ####IP地址####第三行####

        ipad = tk.Button(root, text='SSH批量',font=('仓耳舒圆体 W04', 12),command=self.open_SSH_Interaction)
        ipad.place(relx=0.1, rely=0.28, relwidth=0.15, relheight=0.08)

        lb1 = tk.Label(root, text='V1.2 已测试',font=('仓耳舒圆体 W04', 10))
        lb1.place(relx=0.27, rely=0.28, relwidth=0.2, relheight=0.08)

        ipad = tk.Button(root, text='SSH批量',font=('仓耳舒圆体 W04', 12),command=self.open_SSH_Interaction)
        ipad.place(relx=0.53, rely=0.28, relwidth=0.15, relheight=0.08)

        lb1 = tk.Label(root, text='V1.2 已测试',font=('仓耳舒圆体 W04', 10))
        lb1.place(relx=0.7, rely=0.28, relwidth=0.2, relheight=0.08)
        ####第三行结束####

        ####IP地址####第四行####
        ipad = tk.Button(root, text='Telnet批量',font=('仓耳舒圆体 W04', 12),command=self.open_Telnet_Interaction)
        ipad.place(relx=0.1, rely=0.38, relwidth=0.15, relheight=0.08)




        ####第四行结束####

        ####IP地址####第五行####

        ipad = tk.Button(root, text='子网掩码计算器',font=('仓耳舒圆体 W04', 12),command=lambda:dev1.dev1(root))
        ipad.place(relx=0.1, rely=0.48, relwidth=0.15, relheight=0.08)

        ####第五行结束####

        ####IP地址####第六行####

        ipad = tk.Button(root, text='文本分析',font=('仓耳舒圆体 W04', 12),command=lambda:dev1.dev1(root))
        ipad.place(relx=0.1, rely=0.58, relwidth=0.15, relheight=0.08)

        ####第六行结束####

        ####IP地址####第七行####

        ipad = tk.Button(root, text='地址合成',font=('仓耳舒圆体 W04', 12),command=lambda:dev1.dev1(root))
        ipad.place(relx=0.1, rely=0.68, relwidth=0.15, relheight=0.08)

        ####第七行结束####


        # 在窗体垂直自上而下位置60%处起，布局相对窗体高度40%高的文本框

        by = tk.Label(root, text='version：1.2  |  by:背包的小迟')
        by.place(relx=0.7, rely=0.93, relwidth=0.3, relheight=0.05)

    def open_Ping_Tool(self):
        pingtool = Ping_Tool.ping_tool(self.parent)
    def open_SSH_Interaction(self):
        ssh= SSH_Interaction.SSH(self.parent)
    def open_Telnet_Interaction(self):
        ssh= Telnet_Interaction.Telnet_In(self.parent)
if __name__ == "__main__":
    root = tk.Tk()
    app = MainApplication(root)
    root.geometry('800x600')
    root.minsize(800, 600)  # 最小尺寸
    root.maxsize(800, 600)  # 最大尺寸
    root.title('网络工程师工具箱')
    app.mainloop()